QT += core gui websockets network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
android {QT += androidextras}

TARGET      = open_ipc_client
TEMPLATE    = app
DESTDIR     = $$PWD/./bin

# 设置编译中间文件目录
OBJECTS_DIR = $$PWD/build/obj
MOC_DIR = $$PWD/build/moc
UI_DIR = $$PWD/build/ui
RCC_DIR = $$PWD/build/rcc

SOURCES     += src/main.cpp src/ui/devicesearchwidget.cpp src/ui/firmwareupgradedialog.cpp src/core/network/websocketclient.cpp src/core/discovery/discoveryclient.cpp src/core/device/devicemanager.cpp src/core/device/device.cpp
HEADERS     += src/ui/devicesearchwidget.h src/ui/firmwareupgradedialog.h src/core/network/websocketclient.h src/core/discovery/discoveryclient.h src/core/device/devicemanager.h src/core/device/device.h
FORMS       += src/ui/devicesearchwidget.ui
CONFIG      += warn_off

INCLUDEPATH += $$PWD/src/media/ffmpeg
include ($$PWD/src/media/ffmpeg/ffmpeg.pri)

# LibUV Configuration
INCLUDEPATH += $$PWD/third_party/libuv/libuv-1.51.0/include
INCLUDEPATH += $$PWD/third_party/libuv/libuv-1.51.0/src

win32 {
    DEFINES += WIN32 _WINDOWS WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0600
    
    # LibUV Common Sources
    SOURCES += \
        $$PWD/third_party/libuv/libuv-1.51.0/src/fs-poll.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/idna.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/inet.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/random.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/strscpy.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/strtok.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/thread-common.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/threadpool.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/timer.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/uv-common.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/uv-data-getter-setters.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/version.c
    
    # LibUV Windows Sources
    SOURCES += \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/async.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/core.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/detect-wakeup.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/dl.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/error.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/fs.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/fs-event.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/getaddrinfo.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/getnameinfo.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/handle.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/loop-watcher.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/pipe.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/poll.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/process.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/process-stdio.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/signal.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/snprintf.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/stream.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/tcp.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/thread.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/tty.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/udp.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/util.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/winapi.c \
        $$PWD/third_party/libuv/libuv-1.51.0/src/win/winsock.c
    
    # Required Windows libraries for libuv
    LIBS += -lws2_32 -lpsapi -luserenv -liphlpapi -ldbghelp -lole32 -luuid
}
